﻿using System;
using System.Collections.Generic;
using PPI.Entities.Lookup;
using PPI.WebConsumer;
using VMind.Global;
using System.Data;

namespace PPI.Client.Logic
{
    public class LHandheld
    {
        public static List<EHandheld> SelectAllIdName()
        {
            List<EHandheld> _handhelds = new List<EHandheld>();
            DataTable _dt = WHandheld.SelectAllIdName().Tables[0];
            EHandheld _handheld;

            foreach (DataRow  dr in _dt.Rows)
            {
                _handheld = new EHandheld(ConvertHelper.ToInt32(dr["HandheldId"]), ConvertHelper.Tostring(dr["Name"]));
                _handhelds.Add(_handheld);
            }
            return _handhelds;
        }

        public static int Insert(EHandheld handheld)
        {
            handheld.Id = WHandheld.Insert(handheld.Name);
            return handheld.Id;
        }
    }
}
